using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using EPiAbstractions;
using EPiServer.Core;
using EPiServer.SpecializedProperties;
using JoelAbrahamsson.FeedImport;
using JoelAbrahamsson.PageTypes;
using JoelAbrahamsson.Web.Common;

namespace JoelAbrahamsson.Web.Controllers
{
    public class FavoriteBlogsController : Controller
    {
        private IDataFactoryFacade _dataFactoryFacade;

        public FavoriteBlogsController(IDataFactoryFacade dataFactoryFacade)
        {
            _dataFactoryFacade = dataFactoryFacade;
        }

        public ActionResult Index(int? twitterItemsCount)
        {   
            Start startPage = (Start) _dataFactoryFacade.GetPage(PageReference.StartPage);
            LinkItemCollection blogs = startPage.FavoriteBlogs;
            if(blogs == null)
                blogs = new LinkItemCollection();

            return View(blogs);
        }
    }
}
